/**
 * 数据服务接口
 */

import Vue from 'vue'
import axios from 'axios'

const star = function(callback){
    var url = 'http://localhost:8080/api/score';
    axios.get(url).then( res => {
        callback(res.data.code)
    } )
}

// es6 写法
// 用户登录接口
const login = (username, password, callback) => {
    var url = 'http://localhost:8080/api/login';

    let  data = new FormData();
    data.append("username",username);
    data.append("password",password);

    axios.post(url,data).then( res => {
        callback(res.data);
    })
}

// 用户退出接口
const loginout = (callback) => {
    var url = 'http://localhost:8080/api/loginout';

    axios.get(url).then( res => {
        callback(res.data);
    })
}


export {
    star,
    login,
    loginout
}
